package com.imot.controller;

import com.imot.response.Result;
import com.imot.service.HealthStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * ClassName: HealthStatusController
 * Description:
 * date: 2023/11/29 16:30
 *
 * @author imot-jiah.wang
 */
@Api(tags = "大屏健康态势")
@RestController
@RequestMapping("/api/dashflow")
@RequiredArgsConstructor
public class HealthStatusController {
    private final HealthStatusService healthStatusService;

    @GetMapping("/getDowntime")
    @ApiOperation("获取失效时间")
    public Result getDowntimeController(){
        Result result = healthStatusService.getDowntime();
        return result;
    }

    @GetMapping("/getDeviceDetails")
    @ApiOperation("获取设备详情")
    public Result getDeviceDetailsController(){
        Result result = healthStatusService.getDeviceDetails();
        return result;
    }

    @GetMapping("/getFailurePrediction")
    @ApiOperation("获取失效预测")
    public Result getFailurePredictionController(){
        Result result = healthStatusService.getFailurePrediction();
        return result;
    }

    @GetMapping("/getFaultTypeDistribution")
    @ApiOperation("获取故障类型分布")
    public Result getFaultTypeDistributionController(String date){
        Result result = healthStatusService.getFaultTypeDistribution(date);
        return result;
    }

    @GetMapping("/getFaultDetails")
    @ApiOperation("获取故障详情")
    public Result getFaultDetailsController(){
        Result result = healthStatusService.getFaultDetails();
        return result;
    }

    @GetMapping("/getEnergyConsumptionStats")
    @ApiOperation("获取能耗统计")
    public Result getEnergyConsumptionStatsController(){
        Result result = healthStatusService.getEnergyConsumptionStats();
        return result;
    }
}

